package cn.actoncode.boot.module.ai.dal.mapper.chat;

import cn.actoncode.boot.framework.mybatis.core.mapper.BaseMapperX;
import cn.actoncode.boot.module.ai.dal.dataobject.chat.ChatRecordDO;
import cn.actoncode.boot.module.ai.dal.dataobject.intelligentagent.IntelligentAgentDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 聊天记录 Mapper
 *
 * @author bin
 */
@Mapper
public interface ChatRecordMapper extends BaseMapperX<ChatRecordDO> {

    default void clearChat(Long userId) {
        delete(new LambdaQueryWrapper<ChatRecordDO>()
                .eq(ChatRecordDO::getUserId, userId));
    }

    @Select("SELECT * FROM ai_chat_record WHERE user_id = #{userId} AND deleted = FALSE")
    List<ChatRecordDO> getChatRecordList(@Param("userId") Long userId);
}
